<template>
    <div>
        <div class="index">
            <div class="w1">
                <div class="in">
                    <div class="search_1">
                        <input v-model="val1" type="text">
                    </div>
                    <div class="search_2" @click="Addsearchrecord">搜索</div>
                </div>
                <div class="in2">
                    <span v-for="it,i in Routingarray" :key="i" @click="Jump(i)" :style="[{color: active1 == i? '#00c3ff':''},{borderBottom: active1 == i?'3px solid #00c3ff':''}]">{{it}}</span>
                </div>
                <div class="in3">
                    <router-view />
                </div>
            </div>
            <div class="w2">
                <div class="w2_2">
                    <div class="w2_2_1">
                        <div class="uia1">
                            <img src="https://img-static.mihoyo.com/new_qrcode/qrcode_ys.png" width="100px" alt="">
                            <div class="uia1_1">
                                <span class="ti1">扫码下载米游社App</span>
                                <span class="ti2">了解提瓦特最新资讯</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="w2_4">
                    <div class="w2_4_1">
                        <span>搜索历史</span>
                        <span @click="Search_history = []">清空</span>
                    </div>
                    <div class="w2_4_2" v-show="Search_history != ''">
                        <span v-for="it,i in Search_history" :key="i" @click="val1 = it">{{it}}</span>
                    </div>
                    <div class="w2_4_2" v-show="Search_history == ''">
                        <div class="po1">
                            <img src="https://bbs.mihoyo.com/_nuxt/img/noData.a3d7135.png" alt="">
                        </div>
                        <div class="po1">
                            <p>暂无搜索记录</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <el-backtop :bottom="300" :right='300'> 
            <img src="../assets/img/top.png" alt="">
        </el-backtop>
    </div>
</template>

<script>
export default {
    data() {
        return {
            val1: '',
            active1: 0,
            Routingarray: ['全部','话题','帖子','用户','百科'],
            Search_history: [],
            // 百科数据
            Encyclopediadata: [
                {id: 1, img: 'https://uploadstatic.mihoyo.com/ys-obc/2020/07/09/408757/f8d26d6a9ed0fcba7ab012e03650ea50_2876146447851098207.png', title: '丘丘图腾围栏1'},
                {id: 2, img: 'https://uploadstatic.mihoyo.com/ys-obc/2020/07/09/408757/f8d26d6a9ed0fcba7ab012e03650ea50_2876146447851098207.png', title: '丘丘图腾围栏2'},
                {id: 3, img: 'https://uploadstatic.mihoyo.com/ys-obc/2020/07/09/408757/f8d26d6a9ed0fcba7ab012e03650ea50_2876146447851098207.png', title: '丘丘图腾围栏3'}
            ],
            // 话题数据
            Topicdata: [
                {id: 1, img: 'https://upload-bbs.mihoyo.com/upload/2021/04/21/affd03b42eafef672eacc38647f20dde_4336963425049215104.png?x-oss-process=image/resize,s_150/quality,q_80/auto-orient,0/interlace,1/format,jpg', name: '丘丘梦工厂', title: 'v芬迪vi的四十比ubviufdbsiubusdh'},
                {id: 2, img: 'https://upload-bbs.mihoyo.com/upload/2021/04/21/affd03b42eafef672eacc38647f20dde_4336963425049215104.png?x-oss-process=image/resize,s_150/quality,q_80/auto-orient,0/interlace,1/format,jpg', name: '丘丘梦工厂', title: 'v芬迪vi的四十比ubviufdbsiubusdh'},
                {id: 3, img: 'https://upload-bbs.mihoyo.com/upload/2021/04/21/affd03b42eafef672eacc38647f20dde_4336963425049215104.png?x-oss-process=image/resize,s_150/quality,q_80/auto-orient,0/interlace,1/format,jpg', name: '丘丘梦工厂', title: 'v芬迪vi的四十比ubviufdbsiubusdh'}
            ],
            // 帖子数据
            Postdata: [
                {
                    id: 1,
                    img1: 'https://img-static.mihoyo.com/avatar/avatar10014.png',
                    icon: '../../assets/img/v.png',
                    name: '西风快报员',
                    grade: 'https://img-static.mihoyo.com/level/level16.png',
                    time: '22小时',
                    title: '[百货奇货]活动：开奇货匣得原石!',
                    brief: '常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f',
                    listImg: [
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg'
                    ],
                    label: ['你好uacdfssf','不好吧','太好啦'],
                    views: '168万+',
                    comment: '9800',
                    give: '16万+'
                },{
                    id: 2,
                    img1: 'https://img-static.mihoyo.com/avatar/avatar10014.png',
                    icon: '../../assets/img/v.png',
                    name: '西风快报员',
                    grade: 'https://img-static.mihoyo.com/level/level16.png',
                    time: '22小时',
                    title: '[百货奇货]活动：开奇货匣得原石!',
                    brief: '常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f常年你的GIF不覅u是非哦分工日工日个穷鬼·iOS v hi发vi的比赛v覅u百度f',
                    listImg: [
                        'https://upload-bbs.mihoyo.com/upload/2022/03/30/5f1612a985b3c421e3298bc17618a43b.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/04/29/3fe57965ed348966dd93dfaba28da0f6.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/04/29/b20891f66c723d6c569c1e8f3447671e.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg',
                        'https://upload-bbs.mihoyo.com/upload/2022/05/02/8ffeba1c742e7ef9d38a14c944f39872.jpeg'
                    ],
                    label: ['你好uacdfssf','不好吧','太好啦'],
                    views: '168万+',
                    comment: '9800',
                    give: '16万+'
                }
            ],
            // 用户数据
            userdata: [
                {id: 1, img: 'https://img-static.mihoyo.com/communityweb/upload/6540d2dd603593cf09c6a6a32ce5be40.png', name: '布里丘丘', title: '手工作者', fans: 21221, Getpraise: 988982},
                {id: 2, img: 'https://img-static.mihoyo.com/communityweb/upload/6540d2dd603593cf09c6a6a32ce5be40.png', name: '布里丘丘', title: '手工作者', fans: 21221, Getpraise: 988982},
                {id: 3, img: 'https://img-static.mihoyo.com/communityweb/upload/6540d2dd603593cf09c6a6a32ce5be40.png', name: '布里丘丘', title: '手工作者', fans: 21221, Getpraise: 988982}
            ]
        }
    },
    mounted() {
        this.val()
    },
    // activated() {
    //     this.val()
    // },
    methods: {
        val() {
            // let y = this.$route.query.val
            this.val1 = this.$route.query.val
            this.Search_history.push(this.$route.query.val)
            // console.log('搜索传：', y);
        },
        Addsearchrecord() {
            if(this.val1 !== '') {
                this.Search_history.push(this.val1)
            }
        },
        Jump(i) {
            console.log(i);
            this.active1 = i
            if(i == 0) {
                this.$router.push('/Search1')
            }else if(i == 1) {
                this.$router.push('/Search2')
            }else if(i == 2) {
                this.$router.push('/Search3')
            }else if(i == 3) {
                this.$router.push('/Search4')
            }else if(i == 4) {
                this.$router.push('/Search5')
            }
        }
    }
}
</script>

<style lang="less" scoped>
    .el-backtop img {
        max-width: 100px;
    }
    .index {
            display: flex;
            margin-top: 50px;
            justify-content: center;
            .w1 {
                // border: 1px solid red;
                width: 720px;
                .in {
                        // border: 1px solid red;
                        pointer-events: auto;
                        border-radius: 6px;
                        width: 100%;
                        height: 60px;
                        display: flex;
                        align-items: center;
                        .search_1 {
                            position: relative;
                            width: 80%;
                            padding: 10px;
                            height: 38px;
                            display: flex;
                            align-items: center;
                            background-color: white;
                            input {
                                // border: 1px solid red;
                                width: 100%;
                                border: none;
                                outline: none;
                            }
                        }
                        .search_2 {
                            // border: 1px solid red;
                            width: 20%;
                            height: 100%;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            background-color: #ffe14c;
                            border-radius: 0px 5px 5px 0px;
                            cursor: pointer;
                        }
                }
                .in2 {
                    // border: 1px solid red;
                    border-radius: 6px;
                    margin-top: 20px;
                    background-color: #fff;
                    padding: 10px;
                    span {
                        padding: 10px;
                        margin-left: 10px;
                        // border: 1px solid red;
                        cursor: pointer;
                    }
                }
                .in3 {
                    // border: 1px solid red;
                    // margin-top: 20px;
                    // border-radius: 6px;
                    // background-color: #fff;
                    // padding: 10px;
                }
            }
            .w2 {
                display: flex;
                justify-content: center;
                flex-wrap: wrap;
                width: 260px;
                height: 100%;
                .w2_2 {
                    background-color: white;
                    width: 95%;
                    height: 130px;
                    border-radius: 5px;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    flex-wrap: wrap;
                    cursor: pointer;
                    .w2_2_1 {
                        // border: 1px solid rgb(0, 0, 0);
                        width: 90%;
                        .uia1 {
                            display: flex;
                            align-items: center;
                            // border: 1px solid black;
                            .uia1_1 {
                                // border: 1px solid red;
                                display: flex;
                                align-items: center;
                                justify-content: center;
                                flex-wrap: wrap;
                                font-size: 13px;
                                .ti1 {
                                    color: #00c3ff;
                                }
                                .ti2 {
                                    margin-top: 6px;
                                    color: #999;
                                }
                            }
                        }
                    }
                }
                .w2_4 {
                    // border: 1px solid red;
                    width: 95%;
                    border-radius: 5px;
                    background-color: white;
                    margin-top: 20px;
                    .w2_4_1 {
                        border-bottom: 1px solid #ccc;
                        display: flex;
                        justify-content: space-between;
                        span {
                            // border: 1px solid red;
                            padding: 6px;
                        }
                        span:nth-last-child(2) {
                            // font-size: 14px;
                            font-weight: bolder;
                            font-size: 16px;

                        }
                        span:nth-last-child(1) {
                            font-size: 14px;
                            cursor: pointer;
                        }
                    }
                    .w2_4_2 {
                        // border: 1px solid red;
                        padding: 10px;
                        display: flex;
                        flex-wrap: wrap;
                        // justify-content: center;
                        span {
                            border: 1px solid #ccc;
                            margin-left: 10px;
                            margin-top: 5px;
                            border-radius: 20px;
                            padding: 6px;
                            font-size: 14px;
                            cursor: pointer;
                        }
                        .po1 {
                            display: flex;
                            justify-content: center;
                            width: 100%;
                            img {
                                max-width: 60%;
                            }
                            p {
                                width: 100%;
                                text-align: center;
                                color: #999;
                                font-size: 14px;
                            }
                        }
                    }
                }
            }
        }
</style>